package cn.com.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sun.net.httpserver.Authenticator.Success;
import com.sun.org.apache.bcel.internal.generic.NEW;

import cn.com.biz.DoctorBiz;
import cn.com.biz.NewsBiz;
import cn.com.biz.NoticeBiz;
import cn.com.entity.News;
import cn.com.entity.Notice;

public class IndexAction extends ActionSupport implements SessionAware{

	private NewsBiz newsbiz;
	private NoticeBiz noticebiz;
	private Map<String, Object> session;
	public Map<String, Object> getSession() {
		return session;
	}

	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		session=arg0;
	}
	
	public NewsBiz getNewsbiz() {
		return newsbiz;
	}
	public void setNewsbiz(NewsBiz newsbiz) {
		this.newsbiz = newsbiz;
	}
	public NoticeBiz getNoticebiz() {
		return noticebiz;
	}
	public void setNoticebiz(NoticeBiz noticebiz) {
		this.noticebiz = noticebiz;
	}
	public String getNewsAndNotice(){
		ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");
		noticebiz=(NoticeBiz)ac.getBean("noticebiz");
		newsbiz=(NewsBiz)ac.getBean("newsbiz");
		List<Notice> noticelist=noticebiz.selectAllNotice();
		List<News> newslist=newsbiz.selectAllNews();
		session.put("noticelist", noticelist);
		session.put("newslist", newslist);
		return SUCCESS;
	}

	
}
